<?php

namespace Database\Seeders;

use App\Kuafu\Brand\Model\Brand;
use App\Kuafu\Shop\Model\Shop;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ShopSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {

        $insertArr = [
            [
                'id'         => 50,
                'menuId'     => 1,
                'shopCode'   => '1',
                'shopMobile' => 123,
                'name'       => '生成-日月光分店',
                'address'    => '生成-日月光分店',
                'brandId'    => 1,
                'type'       => 2,
                'imageUrl'   => 'https://www.51kuafu.com/file/storage/image/202101221113498a86f7071.jpg',
                'status'     => 0,
                'startAt'    => 0,
                'endAt'      => 0,
                'isDeleted'  => 0,
                'createdAt'  => time(),
                'updatedAt'  => time()
            ],
            [
                'id'         => 51,
                'shopCode'   => '2',
                'menuId'     => 1,
                'name'       => '生成-浦东长泰分店',
                'address'    => '生成-浦东长泰分店',
                'shopMobile' => 1234,
                'brandId'    => 1,
                'type'       => 1,
                'imageUrl'   => 'https://www.51kuafu.com/file/storage/image/202101221113498a86f7071.jpg',
                'status'     => 0,
                'startAt'    => 0,
                'endAt'      => 0,
                'isDeleted'  => 0,
                'createdAt'  => time(),
                'updatedAt'  => time()
            ],
            [
                'id'         => 52,
                'shopCode'   => '3',
                'menuId'     => 1,
                'name'       => '生成-虹桥火车站分店',
                'address'    => '生成-虹桥火车站分店',
                'shopMobile' => 12345,
                'brandId'    => 1,
                'type'       => 2,
                'imageUrl'   => 'https://www.51kuafu.com/file/storage/image/202101221113498a86f7071.jpg',
                'status'     => 0,
                'startAt'    => 0,
                'endAt'      => 0,
                'isDeleted'  => 0,
                'createdAt'  => time(),
                'updatedAt'  => time()
            ]
        ];

        $table = Shop::query()->getModel()->getTable();
        DB::table($table)->whereIn('id', [50, 51, 52])->delete();
        DB::table($table)->insert($insertArr);
    }
}
